/**
 * 定义站点地图实时数据模块
 */
(function(window, angular, undefined){
	var module = angular.module('water.apps.WasteGas.stationMap.mapManager', ['itfreer',
                                                                        'water.common.publishSubscribe',
                                                                        'water.apps.common.stationMap.stationMapRealDataManager',
	                                                                    'water.entity.district']);
		
	module.controller('mapController',function($gisObject,$scope,$districtService,$pubSubService,$controller){

		/**
		 * 继承地图实时数据
		 */
		var control = $controller("commonStationMapRealDataManagerController",{$scope:$scope});
		
		/**
		 * 政区面板是否显示
		 */
		$scope.areaShow = false;
		
		/**
		 * 选中的政区
		 */
		$scope.selectArea = "深圳市";

		/**
		 * 地图实时数据上显示的参数映射
		 * O2 NOX  烟尘 氧气 烟气流量 烟气流速 CO CO2 氯化氢 氟化物 硫化氢  氨气 温度 VOC 臭气
		 */
		$scope.pollToList =[{name:"02",parmName:"SO2"},{name:"03",parmName:"NOX"},{name:"01",parmName:"烟尘"},{name:"S01",parmName:"氧气"},{name:"AIR_B01TOTAL",parmName:"烟气流量"},
		                     {name:"S02",parmName:"烟气流速"},{name:"04",parmName:"CO"},{name:"30",parmName:"CO2"},{name:"08",parmName:"氯化氢"},
		                     {name:"W21017",parmName:"氟化物"},{name:"H2S",parmName:"硫化氢"},{name:"10",parmName:"氨气"},{name:"S03",parmName:"温度"},
		                     {name:"VOC",parmName:"VOC"},{name:"STINK",parmName:"臭气"}];
		
		/**
		 * 政区开关点击事件
		 */
		$scope.onAreaShowClick = function(){
			$scope.areaShow = !$scope.areaShow;
		}
		
		/**
		 * 政区选择事件
		 */
		$scope.onAreaChange = function(area){
			$scope.areaShow = !$scope.areaShow;
			$scope.selectArea = area.v;
			var extent = new esri.geometry.Extent(area.MINX,area.MINY,area.MAXX,area.MINY,$gisObject.map.spatialReference);
			$gisObject.map.setExtent(extent);
			$pubSubService.publish("mapAreaChange",area);
		}
		
		/**
		 * 加载政区数据
		 */
		function _initArea(){
			$districtService.getDistrictDomain().then(function(data){
				$scope.area = data.qu;
			});
		}
		_initArea();
	});
}(window, angular));


